package fr.pascal.client.ui.animal;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

import fr.pascal.client.place.KangourouPlace;

public class ChatViewImpl extends Composite implements ChatView {

	private static ChatViewImplUiBinder uiBinder = GWT.create(ChatViewImplUiBinder.class);

	interface ChatViewImplUiBinder extends UiBinder<Widget, ChatViewImpl> {
	}

	private Presenter presenter;

	@UiField
	Anchor urlKangourou;
	
	@UiField
	Label nomChat;

	public ChatViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}

	@UiHandler("urlKangourou")
	void onUrlKangourouClick(ClickEvent event) {
		presenter.goTo(new KangourouPlace("skippy"));
	}

	@Override
	public void setNomChat(String nomChat) {
		this.nomChat.setText(nomChat);
	}
}
